package Day16;

import java.util.Scanner;
// 1:无需package
// 2: 类名必须Main, 不可修改

public class Main3 {
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        //在此输入您的代码...
        for(int i = 6359; ; i++){
          String s = "" + (i * (i + 1)) / 2;
          if(check(s)){
            System.out.println(s);
            break;
          }
        }
        scan.close();
    }

    public static boolean check(String s){
      return s.equals(new StringBuffer(s).reverse().toString());
    }
}